package com.hzdesk.media.koreabatchmatvector.logic.view;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hzdesk.media.koreabatchmatvector.R;
import com.hzdesk.media.koreabatchmatvector.custom.HorizontalselectedView;
import com.hzdesk.media.koreabatchmatvector.logic.contract.TimeLineContract;
import com.hzdesk.media.koreabatchmatvector.logic.persenter.TimeLinePersenter;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 时间轴
 */
public class TimeLineActivity extends BaseActivity implements TimeLineContract.ITimeLineView {

    @BindView(R.id.activity_time_line_iv_back)
    ImageView activityTimeLineIvBack;
    @BindView(R.id.activity_time_image_left)
    ImageView activityTimeImageLeft;
    @BindView(R.id.activity_time_line_time_select)
    HorizontalselectedView activityTimeLineTimeSelect;
    @BindView(R.id.activity_time_image_right)
    ImageView activityTimeImageRight;
    @BindView(R.id.activity_time_line_li_time_select)
    LinearLayout activityTimeLineLiTimeSelect;
    @BindView(R.id.activity_time_line_recyclerview)
    RecyclerView activityTimeLineRecyclerview;
    @BindView(R.id.activity_time_line_lin)
    LinearLayout activityTimeLineLin;
    @BindView(R.id.activity_time_line_li_time_re)
    RelativeLayout activityTimeLineLiTimeRe;
    @BindView(R.id.activity_time_line_li_time_tv_default)
    TextView activityTimeLineLiTimeTvDefault;

    private TimeLinePersenter timeLinePersenter = new TimeLinePersenter(this);


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_time_line);
        ButterKnife.bind(this);
        timeLinePersenter.initView(this, activityTimeLineTimeSelect, activityTimeLineRecyclerview);
    }

    @OnClick({R.id.activity_time_line_iv_back, R.id.activity_time_image_left, R.id.activity_time_image_right})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.activity_time_line_iv_back:
                timeLinePersenter.onClickedBack();
                break;
            case R.id.activity_time_image_left:
                timeLinePersenter.onClickedLeftImage();
                break;
            case R.id.activity_time_image_right:
                timeLinePersenter.onClickedRightImage();
                break;
        }
    }

    @Override
    public void setAnLeftOffset() {
        activityTimeLineTimeSelect.setAnRightOffset();


    }

    @Override
    public void setAnRightOffset() {
        activityTimeLineTimeSelect.setAnLeftOffset();

    }

    @Override
    public void back() {
        finish();
    }

    @Override
    public void onItemClick(String uuid) {
        // todo 跳转
        Intent intent = new Intent();
        intent.setClass(this, VideoListActivity.class);
        intent.putExtra("uuid", uuid);
        startActivity(intent);


    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    public void showDefaultPage() {
        activityTimeLineLiTimeSelect.setVisibility(View.GONE);
        activityTimeLineLiTimeRe.setVisibility(View.GONE);
        activityTimeLineLiTimeTvDefault.setVisibility(View.VISIBLE);

    }
}
